package com.yogee.topseller.fragment;

import android.app.Dialog;
import android.app.DialogFragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.yogee.topseller.R;
import com.yogee.topseller.activity.HyqxActivity;
import com.yogee.topseller.activity.PayActivity;
import com.yogee.topseller.interfaces.MyListener;
import com.yogee.topseller.utils.AppUtil;
import com.yogee.topseller.utils.Constants;


/**
 * 首冲
 * Created by Administrator on 2016/9/16.
 */
public class ShouchongFragment extends DialogFragment {



    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        final Dialog mDetailDialog = new Dialog(getActivity(), R.style.dialog);
        mDetailDialog.setContentView(R.layout.pop_shoudan);
        mDetailDialog.setCancelable(false);
        TextView tv_hy = (TextView) mDetailDialog.findViewById(R.id.tv_hy);
        tv_hy.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mDetailDialog.dismiss();
                startActivity(new Intent().setClass(getActivity(),PayActivity.class));
                getActivity().finish();

            }
        });
        TextView tv_more_info = (TextView) mDetailDialog.findViewById(R.id.tv_more_info);
        tv_more_info.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mDetailDialog.dismiss();
                startActivity(new Intent().setClass(getActivity(),HyqxActivity.class).putExtra("url", Constants.HYQX));
                getActivity().finish();

            }
        });
        ImageView img_close = (ImageView) mDetailDialog.findViewById(R.id.img_close);
        img_close.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mDetailDialog.dismiss();
                getActivity().finish();
            }
        });

        String imgurl = getArguments().getString("imgUrl");
        ImageView img_bg = (ImageView) mDetailDialog.findViewById(R.id.img_bg);
        Glide.with(getActivity()).load(imgurl).placeholder(R.drawable.shouchong_bg).error(R.drawable.shouchong_bg).into(img_bg);
        return mDetailDialog;
    }


}
